const { query } = require("../utils/mysql");
module.exports={
    async _getBaseServer(page,size){
        const start = (page-1)*size;
        let sql =  ` select * from cms_student1 limit ${start},${size}`
        return await query(sql)
    },
    async _gettotalBaseServer(){
        let sql= ` select * from cms_student1`
        return await query(sql)
    },
    async _deleteBaseServer(id){
        const sql = ` delete from cms_student1 where id = ${id}`
        return await query(sql)
    },
    async addBaseServer({username,email,time,address,remark,img}){
        let sql= `insert into cms_student1 (username,email,time,address,remark,img) values(?,?,?,?,?,?) `
        return await query(sql,[username,email,time,address,remark,img])
    },
    async updateBaseServer({id,username,email,time,address,remark,img}){
        let sql = ` update cms_student1 set username=?,email=?,time=?,
        address=?,remark=?,img=? where id=?`
        return await query(sql,[username,email,time,address,remark,img,id])
    },
    async SelectBaseServer ({username}){
        let sql = ` select * from cms_student1 where username=?`
        return await query(sql,[username])
    }
}




